# ==============================================================================
#  Copyright 2019-2020 Intel Corporation
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
# ==============================================================================

workspace(name = "ngraph_bridge")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@//tf_configure:tf_configure.bzl", "tf_configure")

tf_configure(
    name = "local_config_tf",
)

# TensorFlow depends on "io_bazel_rules_closure" so we need this here.
# Needs to be kept in sync with the same target in TensorFlow's WORKSPACE file.
http_archive(
    name = "io_bazel_rules_closure",
    sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
    strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
    urls = [
        "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
        "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",  # 2019-06-13
    ],
)

http_archive(
    name = "bazel_skylib",
    sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
    urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz"],
)

http_archive(
    name = "org_tensorflow",
    sha256 = "aa2a6a1daafa3af66807cfe0bc77bfe1144a9a53df9a96bab52e3e575b3047ed",
    strip_prefix = "tensorflow-1.14.0",
    urls = [
        "http://mirror.tensorflow.org/github.com/tensorflow/tensorflow/archive/v1.14.0.tar.gz",
        "https://github.com/tensorflow/tensorflow/archive/v1.14.0.tar.gz",
    ],
)

load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")

tf_workspace(
    path_prefix = "",
    tf_repo_name = "org_tensorflow",
)

http_archive(
    name = "ngraph",
    build_file = "//:bazel/ngraph.BUILD",
    sha256 = "24e723f7ed47e2c0068fb5868d8ca88542948a13c9de063d8108f2b67785b089",
    strip_prefix = "ngraph-0.28.0-rc.1",
    urls = [
        "https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.1.tar.gz",
        "https://github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.1.tar.gz",
    ],
)

http_archive(
    name = "nlohmann_json_lib",
    build_file = "//:bazel/nlohmann_json.BUILD",
    sha256 = "e0b1fc6cc6ca05706cce99118a87aca5248bd9db3113e703023d23f044995c1d",
    strip_prefix = "json-3.5.0",
    urls = [
        "https://mirror.bazel.build/github.com/nlohmann/json/archive/v3.5.0.tar.gz",
        "https://github.com/nlohmann/json/archive/v3.5.0.tar.gz",
    ],
)

http_archive(
    name = "eigen",
    build_file = "//:bazel/eigen.BUILD",
    sha256 = "74845ea27e19a1bcf63f3f271de62e06798f23e0467bb9d45b83a94918941b23",
    strip_prefix = "eigen-eigen-20cbc6576426",
    urls = [
        "http://mirror.tensorflow.org/bitbucket.org/eigen/eigen/get/20cbc6576426.tar.gz",
        "https://bitbucket.org/eigen/eigen/get/20cbc6576426.tar.gz",
    ],
)

http_archive(
        name = "mkl_dnn",
        build_file = "//:bazel/mkl_dnn.BUILD",
        sha256 = "31e78581e59d7e60d4becaba3834fc6a5bf2dccdae3e16b7f70d89ceab38423f",
        strip_prefix = "mkl-dnn-0.21.3",
        urls = [
            "http://mirror.tensorflow.org/github.com/intel/mkl-dnn/archive/v0.21.3.tar.gz",
            "https://github.com/intel/mkl-dnn/archive/v0.21.3.tar.gz",
        ],
    )

http_archive(
        name = "mkl_linux",
        build_file = "//:bazel/mkl.BUILD",
        sha256 = "a936d6b277a33d2a027a024ea8e65df62bd2e162c7ca52c48486ed9d5dc27160",
        strip_prefix = "mklml_lnx_2019.0.5.20190502",
        urls = [
            "http://mirror.tensorflow.org/github.com/intel/mkl-dnn/releases/download/v0.21/mklml_lnx_2019.0.5.20190502.tgz",
            "https://github.com/intel/mkl-dnn/releases/download/v0.21/mklml_lnx_2019.0.5.20190502.tgz",
        ],
    )
